//165
    public int compareVersion(String version1, String version2) {
        String[] v1 = version1.split("\\.");
        String[] v2 = version2.split("\\.");
        int len = Math.min(v1.length, v2.length);
        //System.out.println(len);
        for (int i = 0; i < len; i++) {
            int temp1 = 0;
            int temp2 = 0;
            int t1 = -1;
            int t2 = -1;
            for (int j = 0; j < v1[i].length(); j++) {
                if (v1[i].charAt(j) != '0') {
                    t1 = j;
                    break;
                }
            }
            for (int j = 0; j < v2[i].length(); j++) {
                if (v2[i].charAt(j) != '0') {
                    t2 = j;
                    break;
                }
            }
            if(t1!=-1) {
                temp1 = Integer.parseInt(v1[i].substring(t1));
            }
            if(t2!=-1) {
                temp2 = Integer.parseInt(v2[i].substring(t2));
            }
            //System.out.println(temp1+" "+temp2);
            if (temp1 > temp2) return 1;
            if (temp1 < temp2) return -1;
        }
        if(len==v1.length){
            int t2=-1;
            for(int i=len;i<v2.length;i++){
                for (int j = 0; j < v2[i].length(); j++) {
                    if (v2[i].charAt(j) != '0') {
                        t2 = j;
                        break;
                    }
                }
                int temp2 =0;
                if(t2!=-1) {
                    temp2 = Integer.parseInt(v2[i].substring(t2));
                    if(temp2!=0) return -1;
                }
            }
        }
        if(len==v2.length){
            int t1=-1;
            for(int i=len;i<v1.length;i++){
                for (int j = 0; j < v1[i].length(); j++) {
                    if (v1[i].charAt(j) != '0') {
                        t1 = j;
                        break;
                    }
                }
                int temp1 =0;
                if(t1!=-1) {
                    temp1 = Integer.parseInt(v1[i].substring(t1));
                    if(temp1!=0) return 1;
                }
            }
        }
        return 0;
    }